Custom table handlers #148
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Major contributers to this pull request are
After a couple of iterations I've at something that might work regarding the callback functions discussed in the libmodbus google group.
The purpose of this pull request is to have something to discuss and continue to work on, I don't think this is in a mergable state just yet.
Purpose
To allow the user to have custom handlers for registers and coils. This allows them to make libmodbus read/write into existing settings-structures.
I have designed this to make the user defined handler do as little as possible, basically just fetch a register/bit value. It should be very backwards compatible, if no handlers are specified the library uses default handlers that will work just as previous versions.
The error checks are moved to the handlers allowing user to use structures with gaps in the addressing space for example holding register 1-100 are defined and 982 - 999 are also defined. the default (and previous) implementation does not allow for this but nothing hinders the user to define an handler that verifies the address against a list of valid addresses.
Any comments, insights and/or corrections are welcome =)